﻿using Direct.IDAL.Message;
using DirectSell.Common.Filter;
using Microsoft.Practices.Unity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Web;
using System.Web.Mvc;

namespace DirectSell.WebLayer.Areas.Manager.Controllers
{
    /// <summary>
    /// 首页
    /// </summary>
    public class HomeController : Controller
    {
        [Dependency]
        protected IMessageRepository _msg { get; set; }

        [Dependency]
        protected DirectSell.IMongoDAL.User.IMessageRepository _mongoRepository { get; set; }

        [Dependency]
        protected IMongoDAL.Manager.MessageManage.IMessageManageRepository _mrepository { get; set; }

        // GET: Manager/Home
        [ManagerFilter(IsCheck =true)]
        public ActionResult Index()
        {
            return View();
        }

        /// <summary>
        /// 弹出层
        /// </summary>
        /// <returns></returns>
        public ActionResult Ifarme()
        {
            return PartialView();
        }
        /// <summary>
        /// 查询是否有未读留言
        /// </summary>
        /// <returns></returns>
        public async Task<JsonResult> QueryExist()
        {
            var result = await _mongoRepository.QueryExist();
            if (!result)
            {
                return Json("No");
            }
            return Json("Yes");
        }

    }
}